const crypto = require('crypto-js');

gd = function(e) {
    var t = new Array
      , n = 0;
    for (var i in e)
        t[n] = i,
        n++;
    return t.sort()
}
_d = function e(t) {
    var n;
    if (Array.isArray(t)) {
        for (var r in n = new Array,
        t) {
            var o = t[r];
            for (var i in o)
                null == o[i] ? delete t[r][i] : Array.isArray(t[r][i]) && e(t[r][i])
        }
        return n = t,
        JSON.stringify(n).replace(/^(\s|")+|(\s|")+$/g, "")
    }
    return n = t && t.constructor === Object ? JSON.stringify(t) : t
}
md = function(e) {
    var t = gd(e)
      , n = "";
    for (var i in t) {
        var r = _d(e[t[i]]);
        null != r && "" != r.toString() && (n += t[i] + "=" + r + "&")
    }
    return n
}
fd = function() {
    return function(e) {
        return crypto.MD5(e).toString()
    }
}
pd = function(e, t, time) {
    var n = t + e + time;
    console.log(n);
    
    return n = fd()(n)
}
param={"eid":"","achievementQueryType":"and","achievementQueryDto":[],"personnelQueryDto":{"queryType":"and"},"aptitudeQueryDto":{"queryType":"and","nameStr":"","ename":"中国建筑","aptitudeQueryType":"and","businessScopeQueryType":"or","filePlaceType":"1","aptitudeDtoList":[{"codeStr":"","queryType":"and","aptitudeType":"qualification"}],"aptitudeSource":"new","outCodeStr":"","outQueryType":"or"},"page":{"page":2,"limit":20,"field":"","order":""}}
// function get_sign(param){
//     sign=(
//         time = (new Date).getTime(),
//         t = md(param),
//         pd("ghaepVf6IhcHmgnk4NCTXLApxQkBcvh1", pd("mwMlWOdyM7OXbjzQPulT1ndRZIAjShDB", pd("ZuSj0gwgsKXP4fTEz55oAG2q2p1SVGKK", t, time), time), time))
//         return [time,sign]
//     }
function get_sign(param) {
    var t = md(param),
    time = (new Date).getTime()
    sign = pd("ghaepVf6IhcHmgnk4NCTXLApxQkBcvh1", pd("mwMlWOdyM7OXbjzQPulT1ndRZIAjShDB", pd("ZuSj0gwgsKXP4fTEz55oAG2q2p1SVGKK", t, time), time), time)
    
    console.log(t)
    console.log(sign)
    return [time,sign]
}

// sign=(
//     time = (new Date).getTime(),
//     t = md(param),
//     pd("ghaepVf6IhcHmgnk4NCTXLApxQkBcvh1", pd("mwMlWOdyM7OXbjzQPulT1ndRZIAjShDB", pd("ZuSj0gwgsKXP4fTEz55oAG2q2p1SVGKK", t, time), time), time))

// console.log(sign);
